import { defineStore } from 'pinia'
import { ref } from 'vue'
import { chartColors } from '@/config/colors'

export const useCurveStore = defineStore('curve', {
  state: () => ({
    settings: {
      experimentId: '',
      experimentName: '',
      timeRange: {
        start: '',
        end: ''
      },
      channels: [
        {
          id: 1,
          experimentId: '',
          channel: '',
          transform: '',
          unit: '',
          position: '1',
          color: chartColors[0],
          enabled: true
        }
      ]
    },
    originalData: null,
  }),

  actions: {
    applyTemplate(templateSettings) {
      this.settings = { ...templateSettings }
    },

    resetSettings() {
      this.settings = {
        experimentId: '',
        experimentName: '',
        timeRange: {
          start: '',
          end: ''
        },
        channels: [
          {
            id: 1,
            experimentId: '',
            channel: '',
            transform: '',
            unit: '',
            position: '1',
            color: chartColors[0],
            enabled: true
          }
        ]
      }
    },
    
    setOriginalData(data) {
      this.originalData = data
    },

    getOriginalData() {
      return this.originalData
    }
  }
}) 